package com.android.jump;

import android.graphics.Bitmap;
import android.graphics.Canvas;

public class MenuItem {
	Bitmap mNormal = null;
	Bitmap mClick = null;
	int mPositionX = 0;
	int mPositionY = 0;
	int mWidth = 200;
	int mHeight = 80;
	boolean click  = false;
	
	void setClick(boolean c)
	{
		click = c;
	}
	
	void setPos(int pX, int pY)
	{
		mPositionX = pX;
		mPositionY = pY;
	}
	public boolean isClick(int x, int y){
		if(x> mPositionX && x<mPositionX+mWidth && y>mPositionY && y<mPositionY+mHeight ){
			click = true;
		    return true;
		    }
		else
			return false;
	}

	public MenuItem(Bitmap normal, Bitmap click){
		mNormal = normal;
		mClick = click;
		
	}
	
	void doDraw(Canvas canvas,int key)
	{
		if(key == 2 && click )
		{
			canvas.drawBitmap(mClick, mPositionX, mPositionY, null);
		}
		if(key == 2 &&!click)
		{
			canvas.drawBitmap(mNormal, mPositionX, mPositionY, null);
		}
		
		
		if(click == false){
			if(key == 0)
				return;
			canvas.drawBitmap(mNormal, mPositionX, mPositionY, null);
			}
		else {
			if(key == 0 )
				canvas.drawBitmap(mClick, mPositionX, mPositionY, null);
			else if(key==1) {
				canvas.drawBitmap(mNormal, mPositionX, mPositionY, null);
			    click = false; 
			}
		}
	}
	
}
